#include "tcpserver.hpp"
#include <iostream>
#include <string>
#include <memory>

void Usage(const std::string proc)
{
    std::cout << "\n\rUsage: " << proc << "port[1024+]\n" << std::endl;
}

//./tcpserver 8080
//ip地址采用硬编码0.0.0.0
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(-1);
    }
    uint16_t port = std::stoi(argv[1]);
    const std::string ip = "0.0.0.0";
    std::unique_ptr<TcpServer> tcp_svr(new TcpServer(ip, port));
    tcp_svr->InitServer();
    tcp_svr->StartServer();
    return 0;
}